/*
 * Copyright:  2018 smarabbit studio.
 *
 *  Licensed under the Confluent Community License; you may not use this file
 *  except in compliance with the License.  You may obtain a copy of the License at
 *
 *  http://www.confluent.io/confluent-community-license
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 *  WARRANTIES OF ANY KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations under the License.
 *
 *  @作   者： 黄开晖 (117227773@qq.com)
 *  @日   期:  2021年5月23日
 */
package com.massyframework.beanskin.service.metadata;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * {@link MethodMetadata}, 方法元数据
 */
public interface MethodMetadata  extends Metadata<Method>{

    /**
     * 是否匹配名称为<code>methodName</code>，参数为<code>paramTypes</code>方法
     * @param methodName 方法名称
     * @param paramTypes 参数类型
     * @return {@link boolean},返回<code>true</code>表示匹配，返回<code>false</code>表示不匹配
     */
    boolean matched(String methodName, Class<?>[] paramTypes);

    /**
     * 使用反射方式调用方法
     * @param target 目标实例
     * @param args 参数
     * @return {@link Object}, 返回值
     * @throws IllegalAccessException 访问授权失败抛出的例外
     * @throws IllegalArgumentException 无效的参数抛出的例外
     * @throws InvocationTargetException 调用异常抛出的例外
     */
    Object invoke(Object target, Object... args)
            throws IllegalAccessException, IllegalArgumentException, InvocationTargetException;
}

